package com.artron.mediaartron.ui.fragment.home;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.Menu;
import android.view.View;

import com.artron.baselib.base.BaseStaticFragment;
import com.artron.mediaartron.R;
import com.artron.mediaartron.ui.adapter.VerticalPagerAdapter;
import com.artron.mediaartron.ui.widget.PagerIndicator;

import butterknife.BindView;
import me.kaelaela.verticalviewpager.VerticalViewPager;
import me.kaelaela.verticalviewpager.transforms.DefaultTransformer;

/**
 * Class description here
 *
 * @author doing
 * @version 1.0.0
 * @since 2017-09-20.
 */

public class CustomMadeFragment extends BaseStaticFragment {

    @BindView(R.id.CustomMadeFragment_v_pager)
    protected VerticalViewPager mVerticalPager;
    @BindView(R.id.CustomMadeFragment_pager_indicator)
    protected PagerIndicator mPagerIndicator;

    public static CustomMadeFragment newInstance() {
        Bundle args = new Bundle();
        CustomMadeFragment fragment = new CustomMadeFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_custom_made;
    }

    @Override
    protected void initView() {
        if (isSecondLoad) {
            return;
        }
        VerticalPagerAdapter adapter = new VerticalPagerAdapter(getChildFragmentManager());
        mVerticalPager.setAdapter(adapter);
        mVerticalPager.setOffscreenPageLimit(5);

        mPagerIndicator.setViewPager(mVerticalPager);
    }

    @Override
    public void onDestroy() {
        if (mVerticalPager != null) {
            mVerticalPager.setAdapter(null);
        }
        super.onDestroy();
    }

}
